      SUBROUTINE GETTERM ( USER, TERM )
C*
C*                  *******************************
C*                  *******************************
C*                  **                           **
C*                  **          GETTERM          **
C*                  **                           **
C*                  *******************************
C*                  *******************************
C*
C*     SUBPROGRAM :
C*          GET TERMINAL NAME FOR USER
C*
C*     AUTHOR :
C*          ART RAGOSTA
C*          MS 207-5
C*          AMES RESEARCH CENTER
C*          MOFFETT FIELD, CA  94035
C*          (415) 694-5578
C*
C*     PURPOSE :
C*          CHECK TO SEE IF A USER IS LOGGED ON INTERACTIVELY, AND IF SO
C*          RETURN THE TERMINAL NAME.
C*
C*     INPUT ARGUMENTS :
C*          USER  - THE NAME OF THE USER
C*
C*     OUTPUT ARGUMENTS :
C*          TERM  - THE TERMINAL NAME (EG, 'TTA0' )
C*
C*     INTERNAL WORK AREAS :
C*          NONE
C*
C*     COMMON BLOCKS :
C*          NONE
C*
C*     FILE REFERENCES :
C*          NONE
C*
C*     SUBPROGRAM REFERENCES :
C*          JPI$_TERMINAL
C*          SYS$GETJPIW
C*
C*     ERROR PROCESSING :
C*          NONE
C*
C*     TRANSPORTABILITY LIMITATIONS :
C*          ABSOLUTELY NOT TRANSPORTABLE
C*
C*     ASSUMPTIONS AND RESTRICTIONS :
C*          NONE
C*
C*     LANGUAGE AND COMPILER :
C*          ANSI FORTRAN 77
C*
C*     VERSION AND DATE :
C*          VERSION I.0     12-APR-85
C*
C*     CHANGE HISTORY :
C*          12-APR-85    INITIAL VERSION
C*
C***********************************************************************
C*
      CHARACTER *(*) USER, TERM
      CHARACTER *8 TT
      INTEGER *2 ITEM(2)
      INTEGER *4 ITMLST(3), IOSB(2)
      EQUIVALENCE (ITEM(1),ITMLST(1))
      EXTERNAL JPI$_TERMINAL, SS$_NORMAL
C
      TERM = ' '
C
C --- USE GETJPI TO GET TERMINAL NAME
C
      ITEM(1)   = 8
      ITEM(2)   = %LOC(JPI$_TERMINAL)
      ITMLST(2) = %LOC( TT )
      ITMLST(3) = %LOC( LENG )
      LU        = LENGTH(USER)
      ISTAT     = SYS$GETJPIW ( ,, USER(1:LU), ITMLST, IOSB,, )
      IF ( IOSB(1) .NE. %LOC(SS$_NORMAL) ) GO TO 1000
      TERM      = TT
C
1000  RETURN
      END
C
C---END GETTERM
C
